/* 
 * Selling Partner API for Listings Items
 *
 * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.  For more information, see the [Listings Items API Use Case Guide](doc:listings-items-api-v2021-08-01-use-case-guide).
 *
 * OpenAPI spec version: 2021-08-01
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems
{
    /// <summary>
    /// Offer details of a listings item for an Amazon marketplace.
    /// </summary>
    [DataContract]
    public partial class ItemOfferByMarketplace :  IEquatable<ItemOfferByMarketplace>, IValidatableObject
    {
        /// <summary>
        /// Type of offer for the listings item.
        /// </summary>
        /// <value>Type of offer for the listings item.</value>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum OfferTypeEnum
        {
            
            /// <summary>
            /// Enum B2C for value: B2C
            /// </summary>
            [EnumMember(Value = "B2C")]
            B2C = 1,
            
            /// <summary>
            /// Enum B2B for value: B2B
            /// </summary>
            [EnumMember(Value = "B2B")]
            B2B = 2
        }

        /// <summary>
        /// Type of offer for the listings item.
        /// </summary>
        /// <value>Type of offer for the listings item.</value>
        [DataMember(Name="offerType", EmitDefaultValue=false)]
        public OfferTypeEnum OfferType { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemOfferByMarketplace" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ItemOfferByMarketplace() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemOfferByMarketplace" /> class.
        /// </summary>
        /// <param name="marketplaceId">Amazon marketplace identifier. (required).</param>
        /// <param name="offerType">Type of offer for the listings item. (required).</param>
        /// <param name="price">Purchase price of the listings item (required).</param>
        /// <param name="points">points.</param>
        public ItemOfferByMarketplace(string marketplaceId = default(string), OfferTypeEnum offerType = default(OfferTypeEnum), Money price = default(Money), Points points = default(Points))
        {
            // to ensure "marketplaceId" is required (not null)
            if (marketplaceId == null)
            {
                throw new InvalidDataException("marketplaceId is a required property for ItemOfferByMarketplace and cannot be null");
            }
            else
            {
                this.MarketplaceId = marketplaceId;
            }
            // to ensure "offerType" is required (not null)
            if (offerType == null)
            {
                throw new InvalidDataException("offerType is a required property for ItemOfferByMarketplace and cannot be null");
            }
            else
            {
                this.OfferType = offerType;
            }
            // to ensure "price" is required (not null)
            if (price == null)
            {
                throw new InvalidDataException("price is a required property for ItemOfferByMarketplace and cannot be null");
            }
            else
            {
                this.Price = price;
            }
            this.Points = points;
        }
        
        /// <summary>
        /// Amazon marketplace identifier.
        /// </summary>
        /// <value>Amazon marketplace identifier.</value>
        [DataMember(Name="marketplaceId", EmitDefaultValue=false)]
        public string MarketplaceId { get; set; }


        /// <summary>
        /// Purchase price of the listings item
        /// </summary>
        /// <value>Purchase price of the listings item</value>
        [DataMember(Name="price", EmitDefaultValue=false)]
        public Money Price { get; set; }

        /// <summary>
        /// Gets or Sets Points
        /// </summary>
        [DataMember(Name="points", EmitDefaultValue=false)]
        public Points Points { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class ItemOfferByMarketplace {\n");
            sb.Append("  MarketplaceId: ").Append(MarketplaceId).Append("\n");
            sb.Append("  OfferType: ").Append(OfferType).Append("\n");
            sb.Append("  Price: ").Append(Price).Append("\n");
            sb.Append("  Points: ").Append(Points).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }
  
        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="input">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object input)
        {
            return this.Equals(input as ItemOfferByMarketplace);
        }

        /// <summary>
        /// Returns true if ItemOfferByMarketplace instances are equal
        /// </summary>
        /// <param name="input">Instance of ItemOfferByMarketplace to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ItemOfferByMarketplace input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.MarketplaceId == input.MarketplaceId ||
                    (this.MarketplaceId != null &&
                    this.MarketplaceId.Equals(input.MarketplaceId))
                ) && 
                (
                    this.OfferType == input.OfferType ||
                    (this.OfferType != null &&
                    this.OfferType.Equals(input.OfferType))
                ) && 
                (
                    this.Price == input.Price ||
                    (this.Price != null &&
                    this.Price.Equals(input.Price))
                ) && 
                (
                    this.Points == input.Points ||
                    (this.Points != null &&
                    this.Points.Equals(input.Points))
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.MarketplaceId != null)
                    hashCode = hashCode * 59 + this.MarketplaceId.GetHashCode();
                if (this.OfferType != null)
                    hashCode = hashCode * 59 + this.OfferType.GetHashCode();
                if (this.Price != null)
                    hashCode = hashCode * 59 + this.Price.GetHashCode();
                if (this.Points != null)
                    hashCode = hashCode * 59 + this.Points.GetHashCode();
                return hashCode;
            }
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}
